#set(modelClass = cls.getModuleClass("model"))
#set(modelVar = cls.getModuleVar("model"))
import { alova } from '@/service/request';

/** get #(modelClass) page */
export function paginate#(modelClass)(params?: Api.SearchParams) {
  return alova.Get<Api.PageRow>('/#(cls.mappingPath)/paginate', {
    params
  });
}

/** get all #(modelClass) */
export function list#(modelClass)() {
  return alova.Get<Api.Row[]>('/#(cls.mappingPath)/list');
}

/** create #(modelClass) */
export function create#(modelClass)(data?: Api.Model) {
  return alova.Post<boolean>('/#(cls.mappingPath)/create', data);
}

/** update #(modelClass) */
export function update#(modelClass)(data?: Api.Model) {
  return alova.Post<boolean>('/#(cls.mappingPath)/update', data);
}

/** delete #(modelClass) */
export function delete#(modelClass)(params: Api.DeleteParams) {
  return alova.Post<boolean>('/#(cls.mappingPath)/delete', undefined, { params });
}

/** delete #(modelClass) */
export function batchDel#(modelClass)(params: Api.BatchDeleteParams) {
  return alova.Post<boolean>('/#(cls.mappingPath)/batchDel', undefined, { params });
}
